/**
 * 
 */
package com.lorizz.picpub.test;

import java.util.List;

import org.springframework.core.io.Resource;
import org.springframework.transaction.annotation.Transactional;

import com.lorizz.modeler.data.Importer;

/**
 * @author wind hong
 *
 */
public class DataImporterRunner {
    
    private List<Resource> files;
    private Importer<?> importer;
    
    public void setFiles(List<Resource> files) {
        this.files = files;
    }
    public void setImporter(Importer<?> importer) {
        this.importer = importer;
    }
    
    @Transactional
    public void importData() throws Exception {
        for (Resource r : files) {
            importer.doImport(r.getInputStream());
        }
    }

}
